﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.Contracts;
using System.Linq;

namespace ProjectBase.Core.Settings
{
    /// <summary>
    ///     Implementer should be able to read Project.config and provide its data.
    ///     Other tasks are DbCommand creation etc.
    /// </summary>
    [ContractClass(typeof(Diagnostics.BaseSettingsProvider))]
    public interface IBaseSettingsProvider : IDao
    {
        /// <summary>
        ///     Global.Settings provide access to this object with the Global settings.
        ///     This provider should be able to fill it from the Project.config.
        /// </summary>
        IBaseSettings BaseSettings { get; }

        /// Allows to access any relative path which is combined with this application absolute path.
        /// Useful to find Config files, Priceless to be overrided for testing or batch projects
        string CreateAbsolutePath(string path);

        /// <summary>
        ///     Creates the full path to the 'App_Data' folder. This is the default expected implementation.
        ///     For other purposes (Batch, Tests) target more suitable folder in your implementing IBaseSettingsProvider
        /// </summary>
        /// <param name = "fileName">file name like "file.xml" (with extension)</param>
        /// <returns>The full path to the App_Data folder file</returns>
        string CreateAppDataPath(string fileName);

        string DefaultFilePath(string fileNameOrPath);

        /// <summary>
        ///     The ProjectCore.Data layer can be used for direct ADO.NET handling.
        ///     For that purposes there is 'Db' namespace with 'DbSession' which takes care about
        ///     Request based Connection opening, closing and transaction management.
        ///     Your project based IBaseSettingsProvider simply must provide the correct type (Sql, Oracle etc.)
        /// </summary>
        /// <returns>New IDbCommand instance, which is used on ProjectCore.Data layer for DbSession pruproses</returns>
        IDbCommand NewDbCommand();
    }
}